﻿namespace WMS6.Web.Inventory
{
    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public class MyHeaderTemplate : ITemplate
    {
        private string columnName;
        private DataControlRowType templateType;

        public MyHeaderTemplate(DataControlRowType type, string colname)
        {
            this.templateType = type;
            this.columnName = colname;
        }

        public void InstantiateIn(Control container)
        {
            switch (this.templateType)
            {
                case DataControlRowType.Header:
                {
                    CheckBox headerchk = new CheckBox {
                        ID = "CheckBox1"
                    };
                    headerchk.Attributes.Add("onclick", "selectAll(this,'gvInventory');");
                    container.Controls.Add(headerchk);
                    break;
                }
                case DataControlRowType.DataRow:
                {
                    CheckBox rowchk = new CheckBox {
                        ID = "chbSelect"
                    };
                    container.Controls.Add(rowchk);
                    break;
                }
            }
        }
    }
}

